 //一般性操作
 let fn1 = ()=>{
}
let fn2 = ()=>{
}

fn1();
fn2();
//封装成对象
let a = (callBack )=>{
document.getElementById("xxxA").onclick = function(){
    callBack("a")
}
}
let b = (callBack )=>{
document.getElementById("xxxB").onclick = function(){
    callBack("b")
}
}
//现在有个需求，你点击了a 之后，监听b是否被点击
let isFirst = true;
a(function(name){
console.log("你点击了a")
if(isFirst){
    b(function(name){
        console.log("你点击了b")
    })
}
isFirst = false;
})


//弄成promise
let A = ()=>{
return new Promise((rev,reb)=>{
    document.getElementById("xxxA").onclick=()=>{
        rev("a");
    }
})
}

let B = ()=>{
return new Promise((rev,reb)=>{
    document.getElementById("xxxB").onclick=()=>{
        rev("b");
    }
})
}
let isAFirst = true;
A().then((name)=>{
console.log(name);
if(isAFirst){
    B().then((name)=>{
        console.log(name);
    })
}

})

//弄成await async

function async(){

let isBFirst = true;

let name = await A();
console.log(name);

if(isBFirst){
    let cName = await B();
}


}